package com.zy.explore.order.interfaces.facade.v1;

import com.zy.servicefeign.feign.OrderFeign;
import com.zy.servicefeign.feign.UserFeign;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "Feign测试(统一管理)")
@RestController("/order")
public class TestOrderCommonFeignFacade implements OrderFeign {

    /**
     * 使用聚合的feign测试
     */
    @Resource
    private UserFeign userFeign;

    @Override
    @ApiOperation("测试1")
    @GetMapping("/test1")
    public Integer test1() {
        System.out.println("订单模块通过网关调用用户模块接口，开始");
        Integer s = userFeign.test2();
        System.out.println("订单模块通过网关调用用户模块接口，结束，结果：" + s);
        System.out.println("【service-module-user 调用 service-module-order】 通过网关调用成功");
        return 2;
    }

    @Override
    @ApiOperation("测试2")
    @GetMapping("/test2")
    public Integer test2() {
        System.out.println("其他模块通过网关调用订单模块服务成功");
        return 2;
    }
}
